package com.rabbitmq.rabbit;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;


/**
 * @Author: TongRui乀
 * @Date: 2019/8/2 10:36
 * @description： rabbit 消息生产者
 */
@Component
public class LogMessageListener {

    private Logger logger = LoggerFactory.getLogger(LogMessageListener.class);

    @RabbitListener(queues = "${log.queue.name}", containerFactory = "singleListenerContainer")
    public void receiveMessage(@Payload byte[] message){

        String msg = new String(message);

        logger.info("Log Listener receive message :[{}]", msg);

    }

}
